/*
 * Copyright 2025 The JA-SIG Collaborative. All rights reserved.
 * distributed with this file and available online at
 */
package com.lap.auth.application.api.command;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

@Data
@Schema(description = "创建接口访问日志命令")
public class CreateApiViewLogCmd {

  @NotNull(message = "{apiViewLog.userId.required}")
  @Range(min = 0, max = 2147483647, message = "{apiViewLog.userId.range}")
  @Schema(description = "管理员")
  private Integer userId;

  @NotBlank(message = "{apiViewLog.userName.required}")
  @Length(max = 32, message = "{apiViewLog.userName.max.length}")
  @Schema(description = "用户名")
  private String userName;

  @NotBlank(message = "{apiViewLog.fullName.required}")
  @Length(max = 16, message = "{apiViewLog.fullName.max.length}")
  @Schema(description = "姓名")
  private String fullName;

  @Length(max = 64, message = "{apiViewLog.targetServer.max.length}")
  @Schema(description = "访问实例")
  private String targetServer;

  @Length(max = 64, message = "{apiViewLog.protocol.max.length}")
  @Schema(description = "访问协议")
  private String protocol;

  @NotBlank(message = "{apiViewLog.requestPath.required}")
  @Length(max = 128, message = "{apiViewLog.requestPath.max.length}")
  @Schema(description = "访问地址")
  private String requestPath;

  @NotBlank(message = "{apiViewLog.requestMethod.required}")
  @Length(max = 32, message = "{apiViewLog.requestMethod.max.length}")
  @Schema(description = "访问方法")
  private String requestMethod;

  @Length(max = 64, message = "{apiViewLog.browser.max.length}")
  @Schema(description = "访问者浏览器")
  private String browser;

  @NotBlank(message = "{apiViewLog.clientOs.required}")
  @Length(max = 32, message = "{apiViewLog.clientOs.max.length}")
  @Schema(description = "访问者操作系统")
  private String clientOs;

  @NotBlank(message = "{apiViewLog.requestIp.required}")
  @Length(max = 32, message = "{apiViewLog.requestIp.max.length}")
  @Schema(description = "访问来源IP")
  private String requestIp;

  @NotBlank(message = "{apiViewLog.requestAddress.required}")
  @Length(max = 64, message = "{apiViewLog.requestAddress.max.length}")
  @Schema(description = "访问来源地区")
  private String requestAddress;

  @NotBlank(message = "{apiViewLog.requestBody.required}")
  @Length(max = 429496729, message = "{apiViewLog.requestBody.max.length}")
  @Schema(description = "访问入参")
  private String requestBody;

  @Schema(description = "请求开始时间")
  private LocalDateTime requestTime;

  @Schema(description = "请求结束时间")
  private LocalDateTime responseTime;

  @NotBlank(message = "{apiViewLog.responseData.required}")
  @Length(max = 429496729, message = "{apiViewLog.responseData.max.length}")
  @Schema(description = "访问返回值")
  private String responseData;

  @NotNull(message = "{apiViewLog.times.required}")
  @Range(min = 0, max = 2147483647, message = "{apiViewLog.times.range}")
  @Schema(description = "访问耗时")
  private Long times;
}
